package com.bzkj.web.controller.warehouse;


import com.bzkj.common.core.domain.AjaxResult;
import com.bzkj.inventory.service.InventoryHandleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/stockQuery")
public class InventoryQueryController {

    @Autowired
    private InventoryHandleService inventoryHandleService;

    /**
     * 现存量和可用量查询
     *
     * @param cmaterialoid 物料id
     * @param cstateid     库存状态
     * @param cwarehouseid 仓库id
     * @param vbatchcode   批次号
     * @param dplandate    计划日期
     * @return
     */
    @GetMapping("/inventoryQuery")
    @PreAuthorize("@ss.hasPermi('ncc:InventoryQuery:Job')")
    public AjaxResult inventoryQueryJob(String cmaterialoid, String cstateid, String cwarehouseid, String vbatchcode, String dplandate) {
        return inventoryHandleService.queryInventoryQuery(cmaterialoid, cstateid, cwarehouseid, vbatchcode, dplandate);
    }


    /**
     * 库存状态调整
     * @param cadjuststateid 库存调整后的状态
     * @param cmaterialoid  物料id
     * @param cstateid  库存调整前的状态
     * @param vbatchcode    批次号
     * @param nadjustnum    调整数量
     * @return
     */
    @GetMapping("/statusAdjustment")
    @PreAuthorize("@ss.hasPermi('ncc:StatusAdjustment:Job')")
    public AjaxResult statusAdjustment(String cadjuststateid, String cmaterialoid, String cstateid, String vbatchcode, String nadjustnum) {
        return inventoryHandleService.statusAdjustment(cadjuststateid,cmaterialoid, cstateid, vbatchcode, nadjustnum);
    }
}
